home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MACD 5
/
MACD 5.bin
/
internet
/
yam_i_dodatki
/
yamnet
/
rexx
/
append.rexx
next >
Wrap
OS/2 REXX Batch file
|
1990-03-18
|
2KB
|
73 lines
/* append.rexx */
/*
Format
APPEND [TO] <file1> <file2> [...<fileN>]
Handles a special case of join. Appends <file2> ... <fileN> to <file1>
*/
signal on failure; signal off error; signal on syntax; signal on break_c
options failat 10
call addlib 'rexxextra.library',-20,-30,0
facility = 'Append'
dtemplate = 'TO/A,FILES/...'
template = 'TO/A,FILES/L'
args. = ''
parse arg g_c
do while g_c='?'
options prompt dtemplate': ' /* this template is */
parse pull g_c /* displayed to the user */
if g_c='?' then do
g_s=sourceline(3)
if pos('/*',g_s)=0 then break; if pos('*/',g_s)>0 then break
say
g_s=sourceline(4)
do i=5 while pos('*/',g_s)=0; say g_s; g_s=sourceline(i); end
say
end
end
interpret Cparse(g_c,template,'args')
if args.ERRCODE > 1 then do; say facility'-E-BADARGS,' args.ERRTEXT; exit 5; end
program = 'c:Join'
temp = 't:APPEND.' || Pragma('ID')
c = args.TO
do i = 1 to args.FILES.0
if ~exists(args.FILES.i) then
say facility"-W-NOTFND, can't find" args.FILES.i
else
c = c||' '||args.FILES.i
end
if c = args.TO then do
say facility'-E-NOTFND, no input files found'
retcode = 10
end
else do
''program c 'AS' temp
retcode = rc
'Move' temp args.TO
retcode = max(rc,retcode)
end
GetOut:
exit retcode
break_c:
break_d:
break_e:
break_f:
say facility'-E-BREAK, Control-C interrupt'; retcode = 20; signal GetOut
failure:
say facility'-E-FAIL, Line:' sigl', Error:' rc; retcode = rc; signal GetOut
syntax:
say facility'-E-SYNTAX, Line:' sigl', Error:' rc; retcode = rc; signal GetOut
error:
say facility'-E-ERROR, Line:' sigl', Error:' rc; retcode = rc; signal GetOut